package com.janj.dao;

import com.janj.bean.Phone;
import com.janj.bean.Student;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface StudentOnPhoneMapper {

    @Select("SELECT * FROM student")
    @Results({
            @Result(column = "sid",property = "sid"),
            @Result(column = "sname",property = "sname"),
            @Result(column = "age",property = "age"),
            @Result(
                    column = "sid",
                    property = "p",
                    javaType = Phone.class,
                    one = @One(select = "com.janj.dao.PhoneMapper.selectPhoneByStuid")

            )
    })
    public abstract List<Student> selectStudentOnPhone();

}
